package com.arvato.minipro.service.user;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.arvato.minipro.bean.bean_do.wx.OpenPlatformAuthDo;
import com.arvato.minipro.bean.bean_vo.wx.OpenPlatformAuthVo;
import com.arvato.minipro.mapper.wx.OpenPlatformAuthMapper;

/**
 * 
 * @author: smallking
 * 
 * @Descibe:处理用户授权信息的Service
 * 
 * @Date: 2018年4月19日  下午2:36:24
 */

@Service
@Transactional
public class OpenPlatformAuthService {
	
	@Autowired
	OpenPlatformAuthMapper openPlatformAuthMapper;
	/**
	 * 根据UserId查询授权信息
	 * @param userId
	 * @return
	 */
	public OpenPlatformAuthVo getUserAuthByUserId(String userId) {
		return openPlatformAuthMapper.getUserAuthByUserId(userId);
	}
	/**
	 * 根据APPID查询授权信息
	 * @param userId
	 * @return
	 */
	public OpenPlatformAuthVo getUserAuthByAppId(String appId) {
		return openPlatformAuthMapper.getUserAuthByAppId(appId);
	}
	/**
	 * 插入一个UserAuth
	 * @param UserAuthDo
	 * @return
	 */
	public int insert(OpenPlatformAuthDo UserAuthDo) {
		return openPlatformAuthMapper.insert(UserAuthDo);
	}
	/**
	 * 更新ticket
	 * @param UserAuthDo
	 * @return
	 */
	public int update(OpenPlatformAuthDo UserAuthDo) {
		return openPlatformAuthMapper.update(UserAuthDo);
	}
	
}
